package com.kedacom.demo.cometd;

import org.cometd.annotation.Listener;
import org.cometd.annotation.Service;
import org.cometd.annotation.Session;
import org.cometd.annotation.Subscription;
import org.cometd.bayeux.Channel;
import org.cometd.bayeux.Message;
import org.cometd.bayeux.client.ClientSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * ClientSideAnnotatedService
 * @author luocanfeng
 * @date 2016年4月18日
 */
@Service
public class ClientSideAnnotatedService {

	private Logger logger = LoggerFactory.getLogger(getClass());

	@Session
	private ClientSession bayeuxClient;

	@Listener(Channel.META_CONNECT)
	public void metaConnect(Message connect) {
		logger.debug("Receive connect message: {}", connect);
	}

	@Subscription("/demo")
	public void demo(Message message) {
		logger.debug("Receive demo message: {}", message);
	}

}
